using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_UserControls_UserActionMenu : System.Web.UI.UserControl
{
    private const string CURRENT_ITEM_CLASS = "Selected";

    protected void Page_Load(object sender, EventArgs e)
    {
        UpdateView();
    }

    public void UpdateView()
    {
        BuildMenu();
        ChooseActiveLink();
    }

    public void BuildMenu()
    {


        this.manageUserLink.InnerHtml = "List User";
        this.manageUserLink.HRef = ResolveUrl(string.Format("~/{0}", SitePages.BO_ListUser));

        this.createUserLink.InnerHtml = "Create User";
        this.createUserLink.HRef = ResolveUrl(string.Format("~/{0}", SitePages.BO_CreateUser));

        if (PageManager.IsPage(SitePages.BO_EditUser))
        {
            this.editUserItem.Visible = true;
            this.editUserLink.InnerHtml = "Edit User";
            this.editUserLink.HRef = Request.RawUrl;
        }
    }

    public void ChooseActiveLink()
    {
        if (PageManager.IsPage(SitePages.BO_ListUser))
        {
            MenuManager.SetActive(this.manageUserItem, CURRENT_ITEM_CLASS);
        }
        else if (PageManager.IsPage(SitePages.BO_CreateUser))
        {
            MenuManager.SetActive(this.createUserItem, CURRENT_ITEM_CLASS);
        }
        else if (PageManager.IsPage(SitePages.BO_EditUser))
        {
            MenuManager.SetActive(this.editUserItem, CURRENT_ITEM_CLASS);
        }
    }
}
